package org.adream.account.service;

import java.io.Serializable;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

public class UserDetailsManager implements UserDetailsService,Serializable  {
	/**
	 * 
	 */
	private static final long serialVersionUID = -752464053442293460L;
	
	private final static Logger logger = LoggerFactory.getLogger(UserDetailsManager.class);
	/**
	 * 注入用户信息查询Service
	 */
	@Autowired
	private UserService userService;

	/**
	 * 此处的参数[loginId]为CAS登录画面输入的用户名
	 */
	@Override
	public UserDetails loadUserByUsername(final String loginId) throws UsernameNotFoundException {
		logger.debug("*********loadUserByUsername************");
		logger.debug(loginId);
		

		AdreamUserDetails userDetails = new AdreamUserDetails();
		userDetails.setLoginId(loginId);

		return userDetails;
	}
}